package 并发编程10.final域对于引用类型的重排序思考;

import jdk.nashorn.internal.ir.annotations.Immutable;

import java.util.Collections;

/**
 * @author idea
 * @data 2019/1/26
 */
public class ResetDemo2 {
    final int[] intArr;

    static ResetDemo2 resetDemo2;

    public ResetDemo2(){
        intArr=new int[1];
        intArr[0]=1;
    }

    public static void writeOne(){
        resetDemo2=new ResetDemo2();
    }

    public static void writeTwo(){
        resetDemo2.intArr[0]=2;
    }

    public static void reader(){
        if(resetDemo2!=null){
            int temp1=resetDemo2.intArr[0];
        }
    }
}
